package com.demo.springboot.server.mappers;

import com.demo.springboot.server.bean.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {

    @Insert("insert into products (p_name,p_type,price)values(#{p_name},#{p_type},#{price})")
    Integer add(Product product);

    @Delete("delete from products where pid=#{arg1}")
    Integer deleteById(Integer id);

    @Update("update products set p_name=#{p_name},p_type=#{p_type},price=#{price} where pid=#{pid}")
    Integer update(Product product);

    @Select("select * from products where pid=#{arg1}")
    Product getById(Integer id);

    @Select("select * from products order by pid desc")
    List<Product> queryLists();

}
